package adapter.enumeration_iterator;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;

public class AdapterPattern {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(4);
        list.add("Hello");
        list.add(" ");
        list.add("world");
        list.add("!");

        Iterator<String> iterator = list.iterator();
        Enumeration<String> iteratorEnumeration = new IteratorEnumeration<>(iterator);
        while (iteratorEnumeration.hasMoreElements()) {
            System.out.print(iteratorEnumeration.nextElement());
        }
        System.out.print("\n");
    }

}
